package com.illtamer.infinite.sillage.service;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.illtamer.infinite.sillage.mapper.BlogTagMapper;
import com.illtamer.infinite.sillage.mapper.TagMapper;
import com.illtamer.infinite.sillage.pojo.Tag;
import com.illtamer.infinite.sillage.vo.HomeBlog;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TagService extends BaseMapperService<Tag> {

    @Autowired
    public TagService(BaseMapper<Tag> mapper) {
        super(mapper);
    }

    public List<Tag> listThinTags() {
        return ((TagMapper) mapper).listThinTags();
    }

    public Page<Tag> listThinTags(int currentPage, int limit) {
        return ((TagMapper) mapper).listThinTags(new Page<>(currentPage, limit));
    }

    @Deprecated
    @Override
    public Page<Tag> listEntities(int currentPage, int limit) {
        throw new UnsupportedOperationException("Please use #listTags");
    }

}
